package explorer.abstractFactory.ConcreteFactory;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import explorer.abstractFactory.interfaces.ITextIcon;

public class TextIcon implements ITextIcon{

	
	private BufferedImage image;
	private BufferedImage blueImage;
	private BufferedImage purpleImage;
	private String style= new String();

	
	
	
	
	public TextIcon(String style) {
		super();
		this.style = style;
	}





	@Override
	public BufferedImage loadTextImage() {
		
		if (style.equals("blue")){
			
			if(blueImage==null){
				
				try {
						blueImage=ImageIO.read(new File("iconsblue/text.png"));
					} catch (IOException e) {
						e.printStackTrace();
				}
			}
			
		}else if(style.equals("purple")){
		
			if(purpleImage==null){
				
				try {
					purpleImage=ImageIO.read(new File("iconspurple/Text.png"));
				} catch (IOException e) {
							e.printStackTrace();
				}
			}
		
		}

		if(style.equals("blue")){
			
			image=blueImage;
		
		}else if(style.equals("purple")){
		
			image=purpleImage;
		
		}
		
		return image;
		}
}
